import {
  list,
  getHouseByPointEdit,
  saveElevator,
  getElevatorList,
  savePoint,
  getEmployeeList,
  getPointById,
  enabledControl,
  loadUnbindList,
  showJournalListByPointId,
    pointReboot,
    downloadDeviceLog,
} from '@/services/point/pointService';

export default {
  namespace: 'pointModel',

  state: {},

  effects: {
    *loadUnbindList({ payload, callback }, { call, put }) {
      const response = yield call(loadUnbindList, payload);
      if (callback) callback(response);
    },
    *list({ payload, callback }, { call, put }) {
      const response = yield call(list, payload);
      if (callback) callback(response);
    },
    *houseList({ payload, callback }, { call, put }) {
      const response = yield call(getHouseByPointEdit, payload);
      if (callback) callback(response);
    },
    *saveElevator({ payload, callback }, { call, put }) {
      const response = yield call(saveElevator, payload);
      if (callback) callback(response);
    },
    *elevatorList({ payload, callback }, { call, put }) {
      const response = yield call(getElevatorList, payload);
      if (callback) callback(response);
    },
    *savePoint({ payload, callback }, { call, put }) {
      const response = yield call(savePoint, payload);
      if (callback) callback(response);
    },
    *getEmployeeList({ payload, callback }, { call, put }) {
      const response = yield call(getEmployeeList, payload);
      if (callback) callback(response);
    },
    *getPointById({ payload, callback }, { call, put }) {
      const response = yield call(getPointById, payload);
      if (callback) callback(response);
    },
    *enabledControl({ payload, callback }, { call, put }) {
      const response = yield call(enabledControl, payload);
      if (callback) callback(response);
    },
    *showJournalListByPointId({ payload, callback }, { call, put }) {
      const response = yield call(showJournalListByPointId, payload);
      if (callback) callback(response);
    },
      *pointReboot({ payload, callback }, { call, put }) {
          const response = yield call(pointReboot, payload);
          if (callback) callback(response);
      },
      *downloadDeviceLog({ payload, callback }, { call, put }) {
          const response = yield call(downloadDeviceLog, payload);
          if (callback) callback(response);
      },
  },

  reducers: {},
};
